home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / bcfamily / source / country.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-12  |  1.3 KB  |  51 lines

  1. //
  2. //      *******************************************************************
  3. //        JdeBP C++ Library Routines          General Public Licence v1.00
  4. //            Copyright (c) 1991,1992     Jonathan de Boyne Pollard
  5. //      *******************************************************************
  6. //
  7. // Part of FamAPI.LIB
  8. //
  9.  
  10. #include "famapi.h"
  11. #include "dosdos.h"
  12.  
  13. //
  14. //    Obtain internationalisation information
  15. //
  16. USHORT _APICALL
  17. DosGetCtryInfo ( USHORT Buffersize,
  18.                  DOSCOUNTRYCODE far *PtrCountry,
  19.                  DOSCOUNTRYINFO far *PtrCountryInfo,
  20.                  USHORT far * PtrInfoSize )
  21. {
  22.     struct {
  23.         BYTE InfoID;
  24.         WORD InfoLen;
  25.         DOSCOUNTRYINFO Info;
  26.     } DosInfo ;
  27.     UINT Country  = PtrCountry->country ;
  28.     UINT CodePage = PtrCountry->codepage ;
  29.  
  30.     _ES = FP_SEG(&DosInfo) ;
  31.     _DI = FP_OFF(&DosInfo) ;
  32.     _DX = Country ? Country : -1 ;
  33.     _BX = CodePage ? CodePage : -1 ;
  34.     _CX = Buffersize + 3 ;
  35.     _AX = 0x6501 ;
  36.     Dos3Call() ;
  37.     if (_FLAGS & 0x0001) return _AX;
  38.  
  39.     *PtrInfoSize = _CX ;
  40.  
  41.     unsigned char far *src = (unsigned char far *)&DosInfo.Info ;
  42.     unsigned char far *dst = (unsigned char far *)PtrCountryInfo ;
  43.  
  44.     while (Buffersize--)
  45.         *dst++ = *src++ ;
  46.  
  47.     if (!Country) PtrCountry->country = DosInfo.Info.country ;
  48.     if (!CodePage) PtrCountry->codepage= DosInfo.Info.codepage ;
  49.  
  50.     return NO_ERROR ;
  51. }